import com.sun.jndi.rmi.registry.ReferenceWrapper;
import javax.naming.NamingException;
import javax.naming.Reference;
import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class RmiServer {
    public static void main(String[] args) throws RemoteException, NamingException, AlreadyBoundException {
        System.setProperty("java.rmi.server.hostname","192.168.1.121"); //这里用以公网访问
        Registry registry = LocateRegistry.createRegistry(1099);
        registry.bind("TouchTestFile",new ReferenceWrapper(new Reference("TouchTestFile","TouchTestFile",
                "http://192.168.1.121:80/")));
        System.out.println("rmi启动完成 " + registry.toString());
    }
}
